<extend name="Public:base" />
<block name="main">
    <div class="content" id="js-date">
        <section class="location">
            <i class="iconfont">&#xe60f</i> 位置：<a href="{:U('Index/main')}">管理首页</a> &gt; <a href="{:U('Activity/index')}">抽奖管理</a> &gt; 发布抽奖
        </section>
        <ul class="nav-tabs clearfix">
            <li><a href="{:U('Activity/index')}">抽奖管理</a></li>
            <li class="active">发布抽奖</li>
        </ul>
        <form method="post" action="{:U('Activity/save')}" id="form">
            <input type="hidden" name="id" id="id" value="{$id}" />
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
                <tr>
                    <th width="100">抽奖名称</th>
                    <td><input type="text" name="name" id="name" value="{$data.act_name}" class="form-control form-control-lg" required /> <span class="red"> *</span> 
                        <a href="{:U('Activity/actcode',array('id'=>$id))}">活动二维码管理</a>
                    </td>
                </tr>

                <tr>
                    <th>说明</th>
                    <td><textarea name="profit" id="profit" class="form-control form-control-lg">{$data.act_profit}</textarea> </td>
                </tr>
                <tr>
                    <th>奖项设置<a href="javascript:void(0)" onclick="add_options()">(+)</a></th>
                    <td id="prize_con">
                <volist name="viewList" id="data" empty="暂时没有数据">
                    <div>
                        <input type="hidden" name="prize_id[]" value="{$data.id}"/>
                        名称<input type="text" name="prize_name[]" value="{$data.prize_name}" id="prize_name" class="form-control form-control-xs" required />
                        金额<input type="text" name="prize_money[]" value="{$data.prize_money}" id="prize_money" class="form-control form-control-xs" required />
                        中奖率<input type="text" name="prize_probability[]" value="{$data.prize_probability}" id="prize_probability" class="form-control form-control-xs" required />%
                        <a href="javascript:void(0)" onclick="sub_options(this, '{$data.id}')">(-)</a>
                    </div>
                </volist>

                </td>
                </tr>

            </table>
            <div class="well"><button type="submit" class="btn btn-theme" >发 布</button> <button class="btn btn-gary" onclick="javascript:history.back(-1);">返 回</button></div>
        </form>
    </div>
    <div id="prize_con_hidden" style="display: none">
        <div>
            <input type="hidden" name="prize_id[]" value="0"/>
            名称<input type="text" name="prize_name[]" id="prize_name" class="form-control form-control-xs" required />
            金额<input type="text" name="prize_money[]" id="prize_money" class="form-control form-control-xs" required />
            中奖率<input type="text" name="prize_probability[]" id="prize_probability" class="form-control form-control-xs" required />%
            <a href="javascript:void(0)" onclick="sub_options(this, 0)">(-)</a>
        </div>
    </div>
</block>
<block name="JS">
    <script type="text/JavaScript">
    var prize_con=document.getElementById('prize_con_hidden').innerHTML;
    function add_options(){
        
        $(prize_con).appendTo($('#prize_con'));
    }
    function sub_options(obj,id){
        if(id>0){
            $.getJSON('/Fwadmin/Activity/actdetaildel/id/'+id,function(){
                $(obj).parent().remove();
            });
        }
        else{
        $(obj).parent().remove();
    }
    }
    </script>
</block>
